// PersonInterface接⼝，⽤与限制Person类的格式

//用户的信息

// type User = { username: string; password: string };

interface User {
  username: string;
  readonly password: string;
  age?: number; //？  代表可选属性
  [key: string]: any; //索引签名
}

let user: User;

user = {
  username: "admin",
  password: "123456",
  age: 18,
  sasafsafsa: "",
};

//readonly 属性 不可以被修改
// user.password = "9998989999";

user = {
  username: "root",
  password: "654321",
};

//使用  接口定义函数
// let Fun:(xxx:number)=>number;

interface CountInterface {
  (a: number, b: number): number;
}
const count: CountInterface = (x, y) => {
  return x + y;
};

//接口的合并
interface InterFaceA {
  name: string;
}
interface InterFaceA {
  age: number;
}

let vara: InterFaceA = {
  name: "sjsjsjsjs",
  age: 18,
};
